﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CPPaquetes.DataAccessComponents;
using CPPaquetes.BusinessEntities;
using System.Configuration;

namespace CPPaquetes.BusinessLayer
{
        
    public class UsuarioPV
    {
        CPPaquetes.DataAccessComponents.TurismoEntities _context = new CPPaquetes.DataAccessComponents.TurismoEntities();

        public short GetIdCanal(string UserName)
        {
            aux_usuario usuario = _context.aux_usuario.Where(e => e.CodigoAcceso == UserName).FirstOrDefault();

            if (usuario == null)
                return Convert.ToInt16(ConfigurationManager.AppSettings.Get("IdCanal"));
            if (usuario.IdCanal.HasValue)
                return (short)usuario.IdCanal.Value;
            else return Convert.ToInt16(ConfigurationManager.AppSettings.Get("IdCanal"));
        }
    }
}
